/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package simulation;

import base.node.WSNode;
import utilities.DrawingBean;
import base.node.NodeArchBean;
import java.io.Serializable;
import java.util.Vector;

/**
 * Recontstructs the options defined in GUIOptionManager so as to be sent
 * @author Arvanitis Ioannis
 */
public class GUIOptionTransformer implements Serializable {

    private int commOffset;
    private int totalNodes;
    private int simTimeMin;
    private int simTimeSec;
    private int simTotalTimeInSec;
    private int frequency;
    private int timeScale;
    private int timeScaleTranception;
    private int timeScaleProcessing;
    private String ip;
    private String mapName;
    private int mapWidthMeters;
    private int mapHeightMeters;
    private int mapWidthObstacles;
    private int mapHeightObstacles;
    private int mapWidthRain;
    private int mapHeightRain;
    private Vector<DrawingBean> obstacles;
    private int nodeCategories;
    private Vector<NodeArchBean> nodeArchPerCategory;
    private Vector<DrawingBean> nodes;
    private WSNode[] wsnodes;
    private boolean rpgm;
    private boolean inplace;
    private int maxVelocity;
    private int grid;
    private Vector<DrawingBean> rain;
    private int heavyAttenuation;
    private int lightAttenuation;

    public GUIOptionTransformer() {

        setCommOffset(GUIOptionManager.getCommOffset());
        setFrequency(GUIOptionManager.getFrequency());
        setGrid(GUIOptionManager.getGrid());
        setHeavyAttenuation(GUIOptionManager.getHeavyAttenuation());
        setInplace(GUIOptionManager.isInplace());
        setIp(GUIOptionManager.getIp());
        setLightAttenuation(GUIOptionManager.getLightAttenuation());
        setMapHeightMeters(GUIOptionManager.getMapHeightMeters());
        setMapHeightObstacles(GUIOptionManager.getMapHeightObstacles());
        setMapHeightRain(GUIOptionManager.getMapHeightRain());
        setMapName(GUIOptionManager.getMapName());
        setMapWidthMeters(GUIOptionManager.getMapWidthMeters());
        setMapWidthObstacles(GUIOptionManager.getMapWidthObstacles());
        setMapWidthRain(GUIOptionManager.getMapWidthRain());
        setMaxVelocity(GUIOptionManager.getMaxVelocity());
        if (GUIOptionManager.getNodeArchPerCategory() != null) {
            setNodeArchPerCategory((Vector<NodeArchBean>) GUIOptionManager.getNodeArchPerCategory().clone());
        }
        setNodeCategories(GUIOptionManager.getNodeCategories());
        if (GUIOptionManager.getNodes() != null) {
            setNodes((Vector<DrawingBean>) GUIOptionManager.getNodes().clone());
        }
        if (GUIOptionManager.getObstacles() != null) {
            setObstacles((Vector<DrawingBean>) GUIOptionManager.getObstacles().clone());
        }
        if (GUIOptionManager.getRain() != null) {
            setRain((Vector<DrawingBean>) GUIOptionManager.getRain().clone());
        }
        setRpgm(GUIOptionManager.isRpgm());
        setSimTimeMin(GUIOptionManager.getSimTimeMin());
        setSimTimeSec(GUIOptionManager.getSimTimeSec());
        setSimTotalTimeInSec(GUIOptionManager.getSimTotalTimeInSec());
        setTimeScale(GUIOptionManager.getTimeScale());
        setTimeScaleProcessing(GUIOptionManager.getTimeScaleProcessing());
        setTimeScaleTranception(GUIOptionManager.getTimeScaleTranception());
        setTotalNodes(GUIOptionManager.getTotalNodes());
        setWsnodes(GUIOptionManager.getWsnodes());
    }

    public int getCommOffset() {
        return commOffset;
    }

    public void setCommOffset(int commOffset) {
        this.commOffset = commOffset;
    }

    public int getFrequency() {
        return frequency;
    }

    public void setFrequency(int frequency) {
        this.frequency = frequency;
    }

    public int getGrid() {
        return grid;
    }

    public void setGrid(int grid) {
        this.grid = grid;
    }

    public int getHeavyAttenuation() {
        return heavyAttenuation;
    }

    public void setHeavyAttenuation(int heavyAttenuation) {
        this.heavyAttenuation = heavyAttenuation;
    }

    public boolean isInplace() {
        return inplace;
    }

    public void setInplace(boolean inplace) {
        this.inplace = inplace;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public int getLightAttenuation() {
        return lightAttenuation;
    }

    public void setLightAttenuation(int lightAttenuation) {
        this.lightAttenuation = lightAttenuation;
    }

    public int getMapHeightMeters() {
        return mapHeightMeters;
    }

    public void setMapHeightMeters(int mapHeightMeters) {
        this.mapHeightMeters = mapHeightMeters;
    }

    public int getMapHeightObstacles() {
        return mapHeightObstacles;
    }

    public void setMapHeightObstacles(int mapHeightObstacles) {
        this.mapHeightObstacles = mapHeightObstacles;
    }

    public int getMapHeightRain() {
        return mapHeightRain;
    }

    public void setMapHeightRain(int mapHeightRain) {
        this.mapHeightRain = mapHeightRain;
    }

    public String getMapName() {
        return mapName;
    }

    public void setMapName(String mapName) {
        this.mapName = mapName;
    }

    public int getMapWidthMeters() {
        return mapWidthMeters;
    }

    public void setMapWidthMeters(int mapWidthMeters) {
        this.mapWidthMeters = mapWidthMeters;
    }

    public int getMapWidthObstacles() {
        return mapWidthObstacles;
    }

    public void setMapWidthObstacles(int mapWidthObstacles) {
        this.mapWidthObstacles = mapWidthObstacles;
    }

    public int getMapWidthRain() {
        return mapWidthRain;
    }

    public void setMapWidthRain(int mapWidthRain) {
        this.mapWidthRain = mapWidthRain;
    }

    public int getMaxVelocity() {
        return maxVelocity;
    }

    public void setMaxVelocity(int maxVelocity) {
        this.maxVelocity = maxVelocity;
    }

    public Vector<NodeArchBean> getNodeArchPerCategory() {
        return nodeArchPerCategory;
    }

    public void setNodeArchPerCategory(Vector<NodeArchBean> nodeArchPerCategory) {
        this.nodeArchPerCategory = nodeArchPerCategory;
    }

    public int getNodeCategories() {
        return nodeCategories;
    }

    public void setNodeCategories(int nodeCategories) {
        this.nodeCategories = nodeCategories;
    }

    public Vector<DrawingBean> getNodes() {
        return nodes;
    }

    public void setNodes(Vector<DrawingBean> nodes) {
        this.nodes = nodes;
    }

    public WSNode[] getWsnodes() {
        return wsnodes;
    }

    public void setWsnodes(WSNode[] wsnodes) {
        this.wsnodes = wsnodes;
    }

    public Vector<DrawingBean> getObstacles() {
        return obstacles;
    }

    public void setObstacles(Vector<DrawingBean> obstacles) {
        this.obstacles = obstacles;
    }

    public Vector<DrawingBean> getRain() {
        return rain;
    }

    public void setRain(Vector<DrawingBean> rain) {
        this.rain = rain;
    }

    public boolean isRpgm() {
        return rpgm;
    }

    public void setRpgm(boolean rpgm) {
        this.rpgm = rpgm;
    }

    public int getSimTimeMin() {
        return simTimeMin;
    }

    public void setSimTimeMin(int simTimeMin) {
        this.simTimeMin = simTimeMin;
    }

    public int getSimTimeSec() {
        return simTimeSec;
    }

    public void setSimTimeSec(int simTimeSec) {
        this.simTimeSec = simTimeSec;
    }

    public int getSimTotalTimeInSec() {
        return simTotalTimeInSec;
    }

    public void setSimTotalTimeInSec(int simTotalTimeInSec) {
        this.simTotalTimeInSec = simTotalTimeInSec;
    }

    public int getTimeScale() {
        return timeScale;
    }

    public void setTimeScale(int timeScale) {
        this.timeScale = timeScale;
    }

    public int getTimeScaleProcessing() {
        return timeScaleProcessing;
    }

    public void setTimeScaleProcessing(int timeScaleProcessing) {
        this.timeScaleProcessing = timeScaleProcessing;
    }

    public int getTimeScaleTranception() {
        return timeScaleTranception;
    }

    public void setTimeScaleTranception(int timeScaleTranception) {
        this.timeScaleTranception = timeScaleTranception;
    }

    public int getTotalNodes() {
        return totalNodes;
    }

    public void setTotalNodes(int totalNodes) {
        this.totalNodes = totalNodes;
    }

    public void transformOptions() {
        GUIOptionManager.setWsnodes(getWsnodes().clone());
        GUIOptionManager.setCommOffset(getCommOffset());
        GUIOptionManager.setFrequency(getFrequency());
        GUIOptionManager.setGrid(getGrid());
        GUIOptionManager.setHeavyAttenuation(getHeavyAttenuation());
        GUIOptionManager.setInplace(isInplace());
        GUIOptionManager.setIp(getIp());
        GUIOptionManager.setLightAttenuation(getLightAttenuation());
        GUIOptionManager.setMapHeightMeters(getMapHeightMeters());
        GUIOptionManager.setMapHeightObstacles(getMapHeightObstacles());
        GUIOptionManager.setMapHeightRain(getMapHeightRain());
        GUIOptionManager.setMapName(new String(getMapName()));
        GUIOptionManager.setMapWidthMeters(getMapWidthMeters());
        GUIOptionManager.setMapWidthObstacles(getMapWidthObstacles());
        GUIOptionManager.setMapWidthRain(getMapWidthRain());
        GUIOptionManager.setMaxVelocity(getMaxVelocity());
        GUIOptionManager.setNodeArchPerCategory((Vector<NodeArchBean>) getNodeArchPerCategory().clone());
        GUIOptionManager.setNodeCategories(getNodeCategories());
        GUIOptionManager.setNodes((Vector<DrawingBean>) getNodes().clone());
        if (getObstacles() != null) {
            GUIOptionManager.setObstacles((Vector<DrawingBean>) getObstacles().clone());
        }
        if (getRain() != null) {
            GUIOptionManager.setRain((Vector<DrawingBean>) getRain().clone());
        }
        GUIOptionManager.setRpgm(isRpgm());
        GUIOptionManager.setSimTimeMin(getSimTimeMin());
        GUIOptionManager.setSimTimeSec(getSimTimeSec());
        GUIOptionManager.setSimTotalTimeInSec(getSimTotalTimeInSec());
        GUIOptionManager.setTimeScale(getTimeScale());
        GUIOptionManager.setTimeScaleProcessing(getTimeScaleProcessing());
        GUIOptionManager.setTimeScaleTranception(getTimeScaleTranception());
        GUIOptionManager.setTotalNodes(getTotalNodes());
    }
}
